$wgOut->addWikiMsg( 'talkpagetext' );
}
- # Optional notices on a per-namespace and per-page basis
- $editnotice_ns = 'editnotice-' . $this->mTitle->getNamespace();
- $editnotice_ns_message = wfMessage( $editnotice_ns );
- if ( $editnotice_ns_message->exists() ) {
- $wgOut->addWikiText( $editnotice_ns_message->plain() );
- }
- if ( MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) {
- $parts = explode( '/', $this->mTitle->getDBkey() );
- $editnotice_base = $editnotice_ns;
- while ( count( $parts ) > 0 ) {
- $editnotice_base .= '-' . array_shift( $parts );
- $editnotice_base_msg = wfMessage( $editnotice_base );
- if ( $editnotice_base_msg->exists() ) {
- $wgOut->addWikiText( $editnotice_base_msg->plain() );
- }
- }
- } else {
- # Even if there are no subpages in namespace, we still don't want / in MW ns.
- $editnoticeText = $editnotice_ns . '-' . str_replace( '/', '-', $this->mTitle->getDBkey() );
- $editnoticeMsg = wfMessage( $editnoticeText );
- if ( $editnoticeMsg->exists() ) {
- $wgOut->addWikiText( $editnoticeMsg->plain() );
- }
- }
+ // Add edit notices
+ $wgOut->addHTML( implode( "\n", $this->mTitle->getEditNotices() ) );
if ( $this->isConflict ) {
$wgOut->wrapWikiMsg( "<div class='mw-explainconflict'>\n$1\n</div>", 'explainconflict' );
$pageLang = $contentHandler->getPageViewLanguage( $this );
return $pageLang;
}
+
+ /**
+ * Get a list of rendered edit notices for this page.
+ *
+ * Array is keyed by the original message key, and values are rendered using parseAsBlock, so
+ * they will already be wrapped in paragraphs.
+ *
+ * @since 1.21
+ * @return Array
+ */
+ public function getEditNotices() {
+ $notices = array();
+
+ # Optional notices on a per-namespace and per-page basis
+ $editnotice_ns = 'editnotice-' . $this->getNamespace();
+ $editnotice_ns_message = wfMessage( $editnotice_ns );
+ if ( $editnotice_ns_message->exists() ) {
+ $notices[$editnotice_ns] = $editnotice_ns_message->parseAsBlock();
+ }
+ if ( MWNamespace::hasSubpages( $this->getNamespace() ) ) {
+ $parts = explode( '/', $this->getDBkey() );
+ $editnotice_base = $editnotice_ns;
+ while ( count( $parts ) > 0 ) {
+ $editnotice_base .= '-' . array_shift( $parts );
+ $editnotice_base_msg = wfMessage( $editnotice_base );
+ if ( $editnotice_base_msg->exists() ) {
+ $notices[$editnotice_base] = $editnotice_base_msg->parseAsBlock();
+ }
+ }
+ } else {
+ # Even if there are no subpages in namespace, we still don't want / in MW ns.
+ $editnoticeText = $editnotice_ns . '-' . str_replace( '/', '-', $this->getDBkey() );
+ $editnoticeMsg = wfMessage( $editnoticeText );
+ if ( $editnoticeMsg->exists() ) {
+ $notices[$editnoticeText] = $editnoticeMsg->parseAsBlock();
+ }
+ }
+ return $notices;
+ }
}